<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>考试结果 - 英语单词测试系统</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-success">
    <div class="container-fluid">
        <a class="navbar-brand" href="/student">英语单词测试系统</a>
        <div class="d-flex">
            <a href="/logout" class="btn btn-outline-light">退出登录</a>
        </div>
    </div>
</nav>
<div class="container mt-5">
    <div class="alert alert-info text-center">
        <h4>考试已提交</h4>
        <p>得分：<b>{{ score }}</b> / {{ total }}</p>
    </div>
    <h5>答题详情</h5>
    <table class="table table-bordered align-middle">
        <thead class="table-success">
            <tr>
                <th>题干</th>
                <th>你的答案</th>
                <th>正确答案</th>
                <th>结果</th>
            </tr>
        </thead>
        <tbody>
            {% for q in quiz %}
            <tr>
                <td>{{ q.stem }}</td>
                <td>{{ user_answers[q.id|string] or '未作答' }}</td>
                <td>{{ q.answer }}</td>
                <td>
                    {% if user_answers[q.id|string] == q.answer %}
                        <span class="badge bg-success">正确</span>
                    {% else %}
                        <span class="badge bg-danger">错误</span>
                    {% endif %}
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
    <a href="/student_exams" class="btn btn-secondary">返回考试列表</a>
</div>
</body>
</html>
